local yaping = fk.CreateSkill{
    name = "SP_heg__yaping",
}

Fk:loadTranslationTable{
    ["SP_heg__yaping"] = "雅评",
    [":SP_heg__yaping"] = "出牌阶段限一次，若你有手牌，你可以选择一名其他角色，与其同时展示一张手牌，若两张牌类别：相同，你获得之；不同，弃置展示的牌。",
    ["#SP_heg__yaping"] = "雅评：选择一张手牌和一名其他角色",

    ["$SP_heg__yaping1"] = "识人读心，评荐推达。",
    ["$SP_heg__yaping2"] = "月旦雅评，试论天下。",
}

yaping:addEffect("active",{
  anim_type = "control",
  card_num = 1,
  target_num = 1,
  prompt = "#SP_heg__yaping",
  card_filter = function(self, player, to_select, selected)
    return #selected == 0 and table.contains(player.player_cards[Player.Hand], to_select)
  end,
  target_filter = function(self, player, to_select, selected, selected_cards)
    return #selected == 0 and to_select ~= player and not to_select:isKongcheng() and #selected_cards == 1
  end,
  can_use = function(self, player)
    return player:usedSkillTimes(yaping.name, Player.HistoryPhase) == 0 and not player:isKongcheng()
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local to = effect.tos[1]
    local toCards = room:askToCards(to,{
        min_num = 1,
        max_num = 1,
        include_equip = false,
        skill_name = yaping.name,
        cancelable = false,
    })
    player:showCards(effect.cards)
    to:showCards(toCards)
    local myCard, toCard = Fk:getCardById(effect.cards[1]), Fk:getCardById(toCards[1])
    if myCard.type == toCard.type then
      room:obtainCard(player, toCard, true, fk.ReasonPrey, player.id, yaping.name)
      room:obtainCard(player, myCard, true, fk.ReasonPrey, player.id, yaping.name)
    else
       room:throwCard(myCard, yaping.name, player, player)
       room:throwCard(toCard, yaping.name, to, player)
    end
  end,
})

return yaping